package com.beok.android.joylife.utils;

import android.app.Activity;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by 冯朝 on 2015/4/2.
 */
public class BeokApplication {
    private List<Activity> activityList=new LinkedList<Activity>();
    //private List<Service> serviceList=new LinkedList<Service>();

    private static BeokApplication instance;


    private BeokApplication(){

    }

    public static BeokApplication getInstance(){
        if(null==instance){
            instance=new BeokApplication();
        }

        return instance;
    }


    public void addActivity(Activity activity){

        activityList.add(activity);
    }

   /* public void addService(Service service){

    	serviceList.add(service);
    }*/

    //遍历所有的activity并退出

    public void exit(){
        for(Activity activity:activityList){
            if(activity!=null){
                activity.finish();
            }
        }
        System.exit(0);
    }
}
